package com.tanhua.server.impl;

import cn.hutool.core.util.RandomUtil;
import com.tanhua.dubbo.api.TestSoulApi;
import com.tanhua.model.mongo.Report;
import com.tanhua.model.mongo.SimilarYou;
import com.tanhua.model.mongo.TestList;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class TestSoulService {
    @DubboReference
    private TestSoulApi testSoulApi;

    public List<TestList> getAll() {
        List<TestList> testLists = testSoulApi.getAll();
        return testLists;
    }

    public Report lookReport(String id) {
        Report report = new Report();
        report.setConclusion("猫头鹰：他们的共同特质为重计划、条理、细节精准。在行为上，" +
                "表现出喜欢理性思考与分析、较重视制度、结构、规范。" +
                "他们注重执行游戏规则、循规蹈矩、巨细靡遗、重视品质、敬业负责。风格及决策上，强调权威与果断，擅长危机处"
                );
        report.setCover("https://tanhua0215.oss-cn-hangzhou.aliyuncs.com/2022/01/05/112057de-604e-42ee-b39c-7aad1e69c6c7.jpeg");

        Map map=new HashMap();
        map.put("key","外向");
        map.put("value", RandomUtil.randomInt(50,100)+"%");
        Map map1=new HashMap();
        map1.put("key","理性");
        map1.put("value", RandomUtil.randomInt(50,100)+"%");
        Map map2=new HashMap();
        map2.put("key","判断");
        map2.put("value", RandomUtil.randomInt(50,100)+"%");
        Map map3=new HashMap();
        map3.put("key","抽象");
        map3.put("value", RandomUtil.randomInt(50,100)+"%");
        List list = new ArrayList();
        list.add(map);
        list.add(map1);
        list.add(map2);
        list.add(map3);
        report.setDimensions(list);
        SimilarYou similarYou = new SimilarYou();
        similarYou.setId(3);
        similarYou.setAvatar("https://tanhua-dev.oss-cn-zhangjiakou.aliyuncs.com/images/tanhua/avatar_6.jpg");
        List list2 = new ArrayList();
        list2.add(similarYou);
        report.setSimilarYou(list2);

        return report;
    }
}
